<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no" />
		<title>速翔网络</title>
		<link rel="stylesheet" type="text/css" href="../c/aui.css" />
		<style>
			body{
				background: #fff;
				color: #222;
			}
			.t{
				text-align: center;
				padding-bottom: 0;
			}
			.t div{
				padding: 0.35rem;
			}
			.t img{
				width: 2rem;
				margin: 0 auto;
			}
			.t p{
				color: #222;
				font-size: 0.7rem;
				padding-top: 0.35rem;
			}
			.list{
				margin: 0.25rem;
			}
			.list .a{
				margin: 0.25rem;
				/*background: #fdf9f9;*/
			}
			.list .a img{
				background: #fdf9f9;
				width: 100%;
				height: 100%;
				border-radius: 0.35rem;
			}
			.list .text{
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 0.35rem;
			}
			.list .text{
				font-size: 0.65rem;
			}
			.list .text b{
				font-size: 0.85rem;
				color: #FE2C55;
				padding-right: 0.2rem;
			}
			.list .a .title{
				padding: 0.35rem;
				padding-bottom: 0;
			}
		</style>
	</head>
	<body>
		<div class="aui-content">
			<div class="t aui-card-list-footer aui-hide">
				<div tapmode onclick="_url({url:'shop_member_dingdan_win',title:'我的订单'},'shop_member_dingdan_win')"><img src="../i/i_f_1.png">
					<p>我的订单</p>
				</div>
				<div tapmode onclick="_url_shop({url:'shop_dizhi',title:'收货地址'})"><img src="../i/i_f_2.png">
					<p>收货地址</p>
				</div>
				<!-- <div tapmode onclick="kaidian();"><img src="../i/i_f_3.png">
					<p>开通小店</p>
				</div> -->
				<!-- <div tapmode onclick="kefu();"><img src="../i/shop/i_f_4.png" ><p>联系客服</p></div> -->
			</div>
			<div class="list">
				<script id="sx-list" type="text/x-dot-template">
					{{ for(var i=0,it=it.data; i < it.length; i++) { }}
						<div class="aui-col-xs-6"  tapmode onclick="_url({id:{{= it[i].id}}},'shop_view_win')">
							<div class="a">
								<img src="../i/loading_a.png" suxiangw-src="{{= _img(it[i].img,api.winWidth/2.5) }}" />
								<div class="title aui-ellipsis-1">{{= it[i].title}}</div>
								<div class="text">
									<div><b>{{= it[i].money}}</b>元</div>
									<div>{{= it[i].url ? '来自第三方':'来自小店'}}</div>
								</div>
							</div>
						</div>
						{{ } }}
					</script>
				<div class="aui-row" id="sx-view">
					<div id="jiazai"><img src="../i/loading_more.gif" /></div>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../j/api.js"></script>
	<script type="text/javascript">
		var typeid_data

		function urlsa() {
			var imglen = $("img").length;
			var picurshop = picurl + "/shop";
			for (var i = 0; i < imglen; i++) {
				var tpl = $("img").eq(i).attr("src");
				console.log(tpl);
				tplzwsa = tpl.replace("../i/shop", picurshop);
				$("img").eq(i).attr("src", tplzwsa);
			}
		}
		apiready = function() {
			urlsa();
			_user = _getPrefs('_user');
			console.log(JSON.stringify(_user))
			if (!api.pageParam['typeid'] && api.pageParam['typeid'] == 0) {
				$('.t').removeClass('aui-hide');
			}
			url = 'shop/lists/typeid/' + (api.pageParam['typeid'] ? api.pageParam['typeid'] : 0)
			_shangla(function(ret, err) {
				_list({
					url: url,
					loading: 1
				});
			})
			// 监听滚动
			api.addEventListener({
				name: 'scrolltobottom',
			}, function(ret, err) {
				if (heigutgao == 1) { // heigutgao=1开启执行 0停止执行   防止连续滚动，等加载数据之后在进行滚动。
					pagenum += 1
					_list({
						url: url,
						page: pagenum
					});
				}
			});

		}

		function kefu() {
			var mq = api.require('meiQia');
			var param = {
				appkey: _getPrefs('_config').config.kefu
			};
			mq.initMeiQia(param)
			var titleColor = {
				color: "#000"
			};
			mq.setTitleColor(titleColor);
			var titleBarColor = {
				color: "#fff"
			};
			mq.setTitleBarColor(titleBarColor);
			mq.show();
			var infoParam = {
				age: _user.age == 1 ? '男' : (_user.age == 2 ? '女' : ''),
				avatar: _img(_user.img, 100),
				gender: _user.birthday_name,
				tel: _user.mobile,
				name: _user.username,
				source: _getPrefs('_config').config.title,
				comment: '用户id:' + _user.id
			};
			mq.setClientInfo(infoParam);
		}

		function kaidian() {
			if (!_user.shiming) {
				return _suxiangw_msg({
					content: '开通小店之前，请先实名认证',
					rightTitle: '我要实名',
					url: '_url({url:"member_shiming",title:"实名认证"})'
				})
			}
			if (_user.xiaodian) {
				if (_user.xiaodian.hide == 1) {
					return _suxiangw_msg2({
						content: '小店已通过审核，请到会员中心发布商品',
						rightTitle: '知道了'
					}, function(ret) {
						dialogBox.close({
							dialogName: 'alert'
						})
					})
				} else if (_user.xiaodian.hide == 2) {
					return _suxiangw_msg2({
						content: '小店正在审核，请耐心等待',
						rightTitle: '知道了'
					}, function(ret) {
						dialogBox.close({
							dialogName: 'alert'
						})
					})
				} else if (_user.xiaodian.hide == 0) {
					return _suxiangw_msg2({
						content: '小店已封号，如有申诉请联系客服',
						rightTitle: '知道了'
					}, function(ret) {
						dialogBox.close({
							dialogName: 'alert'
						})
					})
				}
			}
			_url_shop({
				url: 'shop_user_add',
				title: '开通小店'
			})
		}

		function _shop(id) {
			_url({
				id: id,
				get_url: url
			}, 'shop_view_win')
		}
	</script>
</html>
